/*
 * MemResultSet.h
 *
 *  Created on: 2013. 10. 18.
 *      Author: the2
 */

#ifndef MEMRESULTSET_H_
#define MEMRESULTSET_H_

namespace FriendsServer {

#define MAX_RESULTSET				1048576 //1Mbyte
#define MAX_RESULTSET_FIELDSIZE		128


class MemResultSet
{
public:
	MemResultSet();
	virtual ~MemResultSet();

	bool	Init(short row, short field);
	bool	Init(const char *buff, int len);
	bool	Add(const char *item);
	bool	MoreRecord();

private:
	bool	AddShort(short *value);
	bool	AddString(const char *item);
	bool	Allocate();

public:
	char	m_Data[MAX_RESULTSET];
	char	**ROW;
	int		m_Offset;
	short	m_Fields;
	short	m_Rows;
	char	*m_pVal;

private:
	char	*m_pBuff;
	short	m_CurrentField;
	short	m_CurrentRow;
	bool	m_bIsFirstMoreRecord;
};

} /* namespace FriendsServer */
#endif /* RESULTSET_H_ */
